package com.abc.fast.server.user.dao;

import com.abc.fast.common.domain.entity.User;
import com.abc.fast.server.user.mapper.UserMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LiJunXi
 * @since 2024-03-01
 */
@Service
public class UserDao extends ServiceImpl<UserMapper, User> {

    public User selectByUsername(String username) {
        return lambdaQuery().eq(User::getUsername, username)
                .one();
    }

    public boolean checkUsernameUnique(String username) {
        return lambdaQuery().eq(User::getUsername, username).count() == 0;
    }
}
